﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Pixysoft.RTF
{
    public enum RtfBorderSide
    {
        None = 0,
        Left = 0x01,
        Right = 0x02,
        Top = 0x04,
        Bottom = 0x08,
        Default = 0x0F,
        DoubleThickness = 0x10,
        DoubleBorder = 0x20
    }

    public enum RtfFont
    {
        Arial,
        ArialBlack,
        BookmanOldStyle,
        Broadway,
        CenturyGothic,
        Consolas,
        CordiaNew,
        CourierNew,
        FontTimesNewRoman,
        Garamond,
        Georgia,
        Impact,
        LucidaConsole,
        Symbol,
        WingDings,
        MSSansSerif
    }

    public enum RtfAlignment
    {
        None = 0,

        /// <summary>Content is vertically aligned at the bottom, and horizontally aligned at the center.</summary>
        /// <filterpriority>1</filterpriority>
        BottomCenter = 512,
        /// <summary>Content is vertically aligned at the bottom, and horizontally aligned on the left.</summary>
        /// <filterpriority>1</filterpriority>
        BottomLeft = 256,
        /// <summary>Content is vertically aligned at the bottom, and horizontally aligned on the right.</summary>
        /// <filterpriority>1</filterpriority>
        BottomRight = 1024,
        /// <summary>Content is vertically aligned in the middle, and horizontally aligned at the center.</summary>
        /// <filterpriority>1</filterpriority>
        MiddleCenter = 32,
        /// <summary>Content is vertically aligned in the middle, and horizontally aligned on the left.</summary>
        /// <filterpriority>1</filterpriority>
        MiddleLeft = 16,
        /// <summary>Content is vertically aligned in the middle, and horizontally aligned on the right.</summary>
        /// <filterpriority>1</filterpriority>
        MiddleRight = 64,
        /// <summary>Content is vertically aligned at the top, and horizontally aligned at the center.</summary>
        /// <filterpriority>1</filterpriority>
        TopCenter = 2,
        /// <summary>Content is vertically aligned at the top, and horizontally aligned on the left.</summary>
        /// <filterpriority>1</filterpriority>
        TopLeft = 1,
        /// <summary>Content is vertically aligned at the top, and horizontally aligned on the right.</summary>
        /// <filterpriority>1</filterpriority>
        TopRight = 4
    }

    public struct RTFRowDefinition
    {
        private readonly RtfAlignment _alignment;
        private readonly Color _borderColor;
        private readonly int _borderWidth;
        private readonly Padding _padding;
        private readonly RtfBorderSide _rTFBorderSide;
        private int _rowWidth;

        public RTFRowDefinition(int rowWidth, RtfAlignment alignment, RtfBorderSide rTFBorderSide, int borderWidth, Color borderColor, Padding padding)
        {
            this._padding = padding;
            this._alignment = alignment;
            this._rTFBorderSide = rTFBorderSide;
            this._borderWidth = borderWidth;
            this._borderColor = borderColor;
            this._rowWidth = rowWidth * RtfBuilder.TWIPSA4 / 100;
        }

        /// <summary>
        /// Gets the alignment.
        /// </summary>
        /// <value>The alignment.</value>
        public RtfAlignment Alignment
        {

            get { return this._alignment; }
        }

        public Padding Padding
        {

            get { return this._padding; }
        }

        /// <summary>
        /// Gets the RTF border side.
        /// </summary>
        /// <value>The RTF border side.</value>
        public RtfBorderSide RTFBorderSide
        {

            get { return this._rTFBorderSide; }
        }

        /// <summary>
        /// Gets the width of the border.
        /// </summary>
        /// <value>The width of the border.</value>
        public int BorderWidth
        {

            get { return this._borderWidth; }
        }

        /// <summary>
        /// Gets the color of the border.
        /// </summary>
        /// <value>The color of the border.</value>
        public Color BorderColor
        {

            get { return this._borderColor; }
        }

        /// <summary>
        /// Gets or sets the width of the cell.
        /// </summary>
        /// <value>The width of the cell.</value>
        public int RowWidth
        {

            get { return this._rowWidth; }

            set { this._rowWidth = value; }
        }
    }

    public struct RTFCellDefinition
    {
        private RtfAlignment _alignment;
        private Color _borderColor;
        private int _borderWidth;
        private float _cellWidth;
        private Padding _padding;
        private RtfBorderSide _rTFBorderSide;

        private int _x;


        public RTFCellDefinition(int cellwidth, RtfAlignment alignment, RtfBorderSide rTFBorderSide, int borderWidth, Color borderColor, Padding padding)
        {
            this._x = 0;
            this._padding = padding;
            this._alignment = alignment;
            this._rTFBorderSide = rTFBorderSide;
            this._borderWidth = borderWidth;
            this._borderColor = borderColor;
            this._cellWidth = (float)cellwidth / 100;
        }

        /// <summary>
        /// Gets the alignment.
        /// </summary>
        /// <value>The alignment.</value>
        public RtfAlignment Alignment
        {

            get { return this._alignment; }

            set { this._alignment = value; }
        }

        /// <summary>
        /// Gets the RTFborderside.
        /// </summary>
        /// <value>The RTF border side.</value>
        public RtfBorderSide RTFBorderSide
        {

            get { return this._rTFBorderSide; }

            set { this._rTFBorderSide = value; }
        }

        /// <summary>
        /// Gets the width of the border.
        /// </summary>
        /// <value>The width of the border.</value>
        public int BorderWidth
        {

            get { return this._borderWidth; }

            set { this._borderWidth = value; }
        }

        /// <summary>
        /// Gets the color of the border.
        /// </summary>
        /// <value>The color of the border.</value>
        public Color BorderColor
        {

            get { return this._borderColor; }

            set { this._borderColor = value; }
        }

        /// <summary>
        /// Gets or sets the width of the cell.
        /// </summary>
        /// <value>The width of the cell.</value>
        public float CellWidthRaw
        {

            get { return this._cellWidth; }

            set { this._cellWidth = value; }
        }

        /// <summary>
        /// Gets the X.
        /// </summary>
        /// <value>The X.</value>
        public int X
        {

            get { return this._x; }
        }

        public Padding Padding
        {

            get { return this._padding; }

            set { this._padding = value; }
        }

        public void SetX(int value)
        {
            this._x = value;
        }
    }
}
